2000W / 48V LLC Battery-Charger  V1.00
xmc_wdt.c
Go to the documentation of this file.
1 
48 /*********************************************************************************************************************
49  * HEADER FILES
50  ********************************************************************************************************************/
51 #include "xmc_wdt.h"
52 #include "xmc_scu.h"
53 
54 /*********************************************************************************************************************
55  * API IMPLEMENTATION
56  ********************************************************************************************************************/
57 
58 /* Enables watchdog clock and releases watchdog reset. */
59 void XMC_WDT_Enable(void)
60 {
61 #if UC_FAMILY == XMC4
62  XMC_SCU_CLOCK_EnableClock(XMC_SCU_CLOCK_WDT);
63 #endif
64 
65 #if defined(CLOCK_GATING_SUPPORTED)
66  XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_WDT);
67 #endif
68 #if defined(PERIPHERAL_RESET_SUPPORTED)
69  XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_WDT);
70 #endif
71 }
72 
73 /* Disables watchdog clock and resets watchdog. */
74 void XMC_WDT_Disable(void)
75 {
76 #if defined(PERIPHERAL_RESET_SUPPORTED)
77  XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_WDT);
78 #endif
79 #if defined(CLOCK_GATING_SUPPORTED)
80  XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_WDT);
81 #endif
82 
83 #if UC_FAMILY == XMC4
84  XMC_SCU_CLOCK_DisableClock(XMC_SCU_CLOCK_WDT);
85 #endif
86 }
87 /* Initializes and configures watchdog with configuration data pointed by \a config. */
88 void XMC_WDT_Init(const XMC_WDT_CONFIG_t *const config)
89 {
91  WDT->CTR = config->wdt_ctr;
92  WDT->WLB = config->window_lower_bound;
93  WDT->WUB = config->window_upper_bound;
94 }
void XMC_WDT_Enable(void)
Definition: xmc_wdt.c:59
#define WDT
Definition: XMC1400.h:8817
void XMC_SCU_CLOCK_UngatePeripheralClock(const XMC_SCU_PERIPHERAL_CLOCK_t peripheral)
Definition: xmc1_scu.c:636
uint32_t wdt_ctr
Definition: xmc_wdt.h:155
void XMC_WDT_Disable(void)
Definition: xmc_wdt.c:74
uint32_t window_upper_bound
Definition: xmc_wdt.h:134
void XMC_SCU_CLOCK_GatePeripheralClock(const XMC_SCU_PERIPHERAL_CLOCK_t peripheral)
Definition: xmc1_scu.c:628
void XMC_WDT_Init(const XMC_WDT_CONFIG_t *const config)
Definition: xmc_wdt.c:88
uint32_t window_lower_bound
Definition: xmc_wdt.h:138